<?php 
/**
 * @author Kelvin 
 * @mail dangtrungkien89@gmail.com
 * */
require_once("inc_security.php");
$list = new fsDataGird($id_field,$name_field,translate_text("Countries Listing"));

/*
1: Ten truong trong bang
2: Tieu de header
3: kieu du lieu
4: co sap xep hay khong, co thi de la 1, khong thi de la 0
5: co tim kiem hay khong, co thi de la 1, khong thi de la 0
*/
$list->add("new_name","Tiêu đề","string",0,0);
$list->add("new_cat_id","chuyên mục","string",0,0);
$list->add("new_image","Ảnh đại diện","string",0,0);
$list->add("new_date","Ngày cập nhật","string",0,0);
$list->add("",translate_text("Copy"),"copy");
$list->add("",translate_text("Sửa"),"edit");
$list->add("",translate_text("Xóa"),"delete");
$list->ajaxedit($fs_table);



//Lấy dữ liệu
$total			= new db_count("SELECT COUNT(*) AS count 
										 FROM news
										 ORDER BY new_id DESC "); // AND 

$db_listing 	= new db_query("SELECT * 
										 FROM categories_news,news 
                                         where categories_news.cat_id=news.new_cat_id
                                         ORDER BY new_id DESC
										 " . $list->limit($total->total));
$db_listingArr =  $db_listing->result;   
/*$categoriesArr = array() ;                                   
$categories = new db_query("SELECT * 
										 FROM categories
										 ORDER BY cat_id DESC
										 ");
while($row	=	mysql_fetch_assoc($categories->result)){
        $categoriesArr[$row['cat_id']] = $row['cat_name'];
    } 
$manufactoriesArr = array();
$manufactories = new db_query("SELECT * 
										 FROM manufactories
										 ORDER BY man_id DESC
										 ");  
while($row	=	mysql_fetch_assoc($manufactories->result)){
        $manufactoriesArr[$row['man_id']] = $row['man_name'];
    } 
*/
                                                                            		
$total_row		= 	$total->total;	
													 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php echo $load_header?>
<?php echo $list->headerScript()?>
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<?php  /*---------Body------------*/ ?>
<!--<form action="quickedit.php?returnurl=<?php echo base64_encode(getURL())?>" method="post" name="form_listing" id="form_listing" enctype="multipart/form-data">
<input type="hidden" name="iQuick" value="update" />-->
<div id="listing">
  <?php echo $list->showHeader($total_row)?>
	
  <?php 
  	$i = 1;
	while($row	=	mysql_fetch_assoc($db_listingArr))
	{
		?>
		<?php echo $list->start_tr($i, $row['new_id'])?>
		<td width="100" align="center"><input style="width: 200px;" type="text" name="new_title<?php echo $row['new_id']?>" value="<?php echo $row['new_title']?>"    onkeyup="check_edit('record_<?php echo $i?>')" /></td>
		<td width="100" align="center"><span style="color: black;font-size: 14px;"><?php echo $row['cat_name']?></span></td>
        <td width="100" align="center"><img src="../../../images/news_image/<?php echo $row['new_image']?>" alt="<?php echo $row['new_title']?>" width="150px" /></td>
        <td width="100" align="center"><?php echo date('d/m/y',$row['new_date'])?></td>
        <?php echo $list->showCopy($row['new_id'])?>
		<?php echo $list->showEdit($row['new_id'])?>
		<?php echo $list->showDelete($row['new_id'])?>
		<?php echo $list->end_tr()?>
		<?php 
		$i	+=1;
	}
	?>

  <?php echo $list->showFooter($total_row)?> 
</div>
<!--</form>-->
<?php  /*---------Body------------*/ ?>
</body>
</html>